package cn.itsource.zcn.org.controller;

import cn.itsource.zcn.org.domain.Employee;
import cn.itsource.zcn.org.service.IEmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/success")
public class SuccessController {

    @Autowired
    private IEmployeeService employeeService;

    @RequestMapping("/active")
    public String pass(Long id){
        try {
            Employee employee = employeeService.queryById(id);
            employee.setState(1);
            employeeService.update(employee);
            return "您的管理员账号已激活!请前往<a href='http://127.0.0.1:8081/#/login'>登录地址</a>";
        } catch (Exception e) {
            e.printStackTrace();
            return "系统出错!";
        }
    }
}
